home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / mayaSoftwareGetCommonGlobalV < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.1 KB  |  133 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. global proc string mayaSoftwareGetCommonGlobalValue(
  18.     string $global)
  19. {
  20.     //
  21.     // Description:
  22.     //    This procedure is called when the current renderer has changed from the
  23.     //    Maya Software renderer to something else.
  24.     //    This procedure returns the value of the common global specified by
  25.     //    $global.
  26.     //    For a complete list of valid values for the $global argument, and to
  27.     //    see how this procedure is used, see copyCommonRenderGlobals.mel.
  28.     //
  29.     // Returns: 
  30.     //    The value of the specified common global, as a string. 
  31.     //
  32.  
  33.     string     $value;
  34.  
  35.     switch ($global)
  36.     {
  37.         case "animation":
  38.             $value = `getAttr defaultRenderGlobals.animation`;
  39.             break;
  40.         case "startFrame":
  41.             $value = `getAttr defaultRenderGlobals.startFrame`;
  42.             break;
  43.         case "endFrame":
  44.             $value = `getAttr defaultRenderGlobals.endFrame`;
  45.             break;
  46.         case "byFrame":
  47.             $value = `getAttr defaultRenderGlobals.byFrameStep`;
  48.             break;
  49.         case "framePadding":
  50.             $value = `getAttr defaultRenderGlobals.extensionPadding`;
  51.             break;
  52.         case "renderableObjects":
  53.             if (`getAttr defaultRenderGlobals.renderAll` == 1)
  54.             {
  55.                 $value = "all";
  56.             }
  57.             else
  58.             {
  59.                 $value = "selected";
  60.             }
  61.             break;
  62.         case "useCustomExtension":
  63.             if (`getAttr "defaultRenderGlobals.outFormatControl"` == 2)
  64.             {
  65.                 $value = "1";
  66.             }
  67.             else
  68.             {
  69.                 $value = "0";
  70.             }
  71.             break;
  72.         case "customExtension":
  73.             $value = `getAttr defaultRenderGlobals.outFormatExt`;
  74.             break;
  75.         case "renumberFramesUsing":
  76.             $value = `getAttr defaultRenderGlobals.modifyExtension`;
  77.             break;
  78.         case "renumberStartFrame":
  79.             $value = `getAttr defaultRenderGlobals.startExtension`;
  80.             break;
  81.         case "renumberByFrame":
  82.             $value = `getAttr defaultRenderGlobals.byExtension`;
  83.             break;
  84.         case "maintainWidthHeightRatio":
  85.             $value = `getAttr defaultResolution.aspectLock`;
  86.             break;
  87.         case "width":
  88.             $value = `getAttr defaultResolution.width`;
  89.             break;
  90.         case "height":
  91.             $value = `getAttr defaultResolution.height`;
  92.             break;
  93.         case "lockDeviceAspectRatio":
  94.             $value = `getAttr defaultResolution.lockDeviceAspectRatio`;
  95.             break;
  96.         case "deviceAspectRatio":
  97.             $value = `getAttr defaultResolution.deviceAspectRatio`;
  98.             break;
  99.         case "pixelAspectRatio":
  100.            
  101.             float $deviceAspectRatio = 
  102.                 `getAttr defaultResolution.deviceAspectRatio`;
  103.             float $width = `getAttr defaultResolution.width`;
  104.             float $height = `getAttr defaultResolution.height`;
  105.             float  $pixelAspectRatio = 
  106.                 $deviceAspectRatio * $height / $width ;
  107.             $value = $pixelAspectRatio;
  108.             break;
  109.         case "enableDefaultLight":
  110.             $value = `getAttr defaultRenderGlobals.enableDefaultLight`;
  111.             break;
  112.         case "pluginFormat":
  113.             $value = `getAttr defaultRenderGlobals.pluginFormat`;
  114.             break;
  115.         case "preRenderMel":
  116.             $value = `getAttr defaultRenderGlobals.preRenderMel`;
  117.             break;
  118.         case "postRenderMel":
  119.             $value = `getAttr defaultRenderGlobals.postRenderMel`;
  120.             break;
  121.         default:
  122.             warning(
  123.                 "mayaSoftwareGetCommonGlobalValue() was asked for the value "
  124.                 + "of a global ("
  125.                 + $global 
  126.                 + ") it does not support. "
  127.                 + "Modify mayaSoftwareHasCommonGlobal() to fix the problem\n");
  128.             break;
  129.     }
  130.  
  131.     return $value;
  132. }
  133.